package com.itheima.d1_TimerDemo;

import java.sql.Time;
import java.util.Timer;
import java.util.TimerTask;

/**
 * Timer定时器的使用和了解
 */
public class TimerDemo {
    public static void main(String[] args) {
        // 1. 创建Timer定时器
        Timer timer = new Timer();
        timer.schedule(new TimerTask() {
            @Override
            public void run() {
                System.out.println(Thread.currentThread().getName()+":"+"执行一次");
            }
        }, 3000,2000);
    }
}
